﻿
using System.Data.Common;
using Foothill.DataAccess.Repository;
using Foothill.DataAccess;

namespace Foothill.Filter.Test.TestUtilities
{
    internal class DatabaseUtility : DbAccessBase
    {
        internal DatabaseUtility()
        {
            UseDatabase(DatabaseToUse.Test);
        }

        internal static void ClearAdForSaleTable()
        {
            ClearTable("AdForSale");
        }

        internal static void ClearPhotoTable()
        {
            ClearTable("Photo");
        }

        private static void ClearTable(string tableName)
        {
            string sql = string.Format("DELETE FROM {0}", tableName);

            DbCommand dbCommand = FoothillDB.GetSqlStringCommand(sql);
            FoothillDB.ExecuteNonQuery(dbCommand);
        }
    }
}
